home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc1_2_x / smrtslds.sit / SmartSlides 1.1 Demo / stack.txt < prev   
Text File  |  1990-06-12  |  32KB  |  1,007 lines

  1. -- stack: in.1 Demo
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 2
  11. -- first background id: 2635
  12. -- card count: 14
  13. -- first card id: 2994
  14. -- list block id: 10040
  15. -- print block id: 3522
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 4
  19. -- free size: 10752 bytes
  20. -- total size: 163840 bytes
  21. -- stack block size: 30208 bytes
  22. -- created by hypercard version: 0x01228000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xEE88BB22EE88BB22
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x018648281905030F
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0x7E7E7E7E7E7E7E7E
  63. -- patterns[37]: 0x00FFFFFFFFFFFF00
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. -- SmartSlides version 1.1
  69. -- design and all scripts
  70. -- copyright, 4 June 1990
  71. -- Mark A. Brown
  72. -- Philosophy Department
  73. -- Syracuse University
  74. -- Syracuse, NY  13244
  75. -- (315) 443-5818
  76.  
  77. -- Menu XCMDs and XFCNs are from freeware made available by
  78. -- Nine To Five Software. My thanks to them.
  79.  
  80. on startUp
  81.   --disables handler in Home Stack which would reset
  82.   --userlevel when stack is opened by double-clicking
  83. end startUp
  84.  
  85. on openStack
  86.   global Speed, FlashNumber, ShortDelay, LongDelay, TabWidth, FieldsLocked, ToolView, Squeezer, LineWidth, Linking
  87.   hide menuBar
  88.   set the userLevel to 5
  89.   set the cursor to browse
  90.   put 100 into speed      --normal speed for dragging
  91.   put 4 into FlashNumber  --number of times to flash
  92.   put 5 into ShortDelay   --interval between flashes of flasher buttons
  93.   put 20 into LongDelay   --length of flashes of flasher buttons
  94.   put false into Squeezer --don't squeeze lines in text fields at first
  95.   put 3 into LineWidth    --standard thickness of lines
  96.   put 5 into TabWidth     --standard indent created by Tabbing
  97.   put false into Linking  --not linking cards at first
  98.   set the hilite of background button id 99 to false
  99.   --                      --not chaining
  100.  
  101.   if the number of cards <= 2 then  --seed stack
  102.     put (the number of card fields is not 0) into FieldsLocked
  103.     --no locked fields in seed stack
  104.     send SetUp to background button id 26-- of card 1
  105.     show menubar
  106.   else                             --developed stack
  107.     put "Precycling Cards"
  108.     lock screen
  109.     set the cursor to browse
  110.     put 2000 into Speed
  111.     show all cards
  112.     go first
  113.     put 100 into speed
  114.     put empty
  115.     hide msg
  116.     hide menubar
  117.     unlock screen
  118.     beep                           --to signal end of precycling
  119.     put true into FieldsLocked     --no unlocked fields at first
  120.   end if
  121. end openStack
  122.  
  123. on closeStack
  124.   lock screen
  125.   set the lockmessages to true
  126.   push card
  127.   go first
  128.   send HideTools to background "Work"
  129.   pop card
  130.   set the lockmessages to false
  131.   unlock screen
  132.   if (freeSize of this stack) > 0 and the optionKey is not down then
  133.     domenu "Compact Stack"
  134.   end if
  135. end closeStack
  136.  
  137. on lockFields
  138.   global FieldsLocked, FieldMenu
  139.   choose Browse tool
  140.   repeat with i = 1 to the number of card fields
  141.     set the locktext of card field i to true
  142.   end repeat
  143.   put true into FieldsLocked
  144.   ChangeMenu FieldMenu,14,"Unlock All┬á"
  145.   set the icon of background button id 25 to "LockedFields"
  146. end lockFields
  147.  
  148. on unlockFields
  149.   global FieldsLocked, FieldMenu
  150.   repeat with i = 1 to the number of card fields
  151.     set the locktext of card field i to false
  152.   end repeat
  153.   put false into FieldsLocked
  154.   ChangeMenu FieldMenu,14,"Lock All┬á"
  155.   set the icon of background button id 25 to "UnlockedFields"
  156. end unlockFields
  157.  
  158. on NoScripts
  159.   lock screen
  160.   set the lockmessages to true
  161.   go next
  162.   go previous
  163.   set the lockmessages to false
  164.   unlock screen
  165.   if field "GraphArea" is not empty or field "LineSpecs" is not empty
  166.   then
  167.   answer "Delete slide's line/arrow/graph buttons?" with "Okay" or "Cancel"
  168.   if it is "Okay" then
  169.     requestPatience
  170.     choose button tool
  171.     set the cursor to busy
  172.     repeat with i = the number of buttons down to 1
  173.       if the short name of button i is "Draw" or the short name of button i is "Graph"
  174.       then
  175.       set the cursor to busy
  176.       select button i
  177.       doMenu "clear button"
  178.     end if
  179.   end repeat
  180.   choose browse tool
  181.   unlock screen
  182.   put empty into field "LineSpecs"
  183.   put empty into field "GraphArea"
  184.   put empty into msg
  185.   hide msg
  186. end if
  187. end if
  188. end NoScripts
  189.  
  190. on SetFont
  191.   global Mode, Squeezer
  192.   put word 1 of Mode into NewFont
  193.   put word 2 of Mode into NewSize
  194.   set the textFont of the target to NewFont
  195.   set the textSize of the target to NewSize
  196.   if Squeezer is true
  197.   then
  198.   set the textHeight of the target to (NewSize + 2)
  199. else
  200.   set the textHeight of the target to (4*NewSize)/3
  201. end if
  202. end SetFont
  203.  
  204. on SetRate
  205.   if first word of short name of target is not "AutoScroller"
  206.   then
  207.   answer "That is not an autoscrolling field." with "Okay"
  208. else
  209.   ask "Enter desired number of pixels/scroll cycle." with word 2 of short name of target
  210.   if it is not empty
  211.   then
  212.   if it > 0 and (length of it) < 3
  213.   then
  214.   set the name of target to "Autoscroller " & it
  215. else
  216.   answer "Need a whole number.  Try again." with "Okay"
  217. end if
  218. end if
  219. end if
  220. end SetRate
  221.  
  222. on requestClick clicks
  223.   show msg at 15,320
  224.   if clicks is empty or clicks is 1 then put "Click on desired field."
  225.   if clicks is 2 then put "Click at beginning and at end desired."
  226. end requestClick
  227.  
  228. on request2Fields
  229.   show msg at 15,320
  230.   put "Click on two fields to connect."
  231. end request2Fields
  232.  
  233. on requestPatience
  234.   show msg at 15,320
  235.   put "There will be a slight delay. Please be patient."
  236. end requestPatience
  237.  
  238. on requestCard
  239.   show msg at 15,270
  240.   put "Please go to the desired card and click on it."
  241. end requestCard
  242.  
  243. on Reset
  244.   CleanUp
  245.   lockFields
  246.   put (freesize of this stack) into FS
  247.   if FS > 10000
  248.   then
  249.   put "Compacting Stack (" & FS & " free)"
  250.   domenu "Compact Stack"
  251.   put empty into msg
  252.   hide msg
  253. end if
  254. beep
  255. end Reset
  256.  
  257. on resetAll
  258.   push card
  259.   requestPatience
  260.   lock screen
  261.   set the lockMessages to true
  262.   put the number of cards of background "work" into lastcard
  263.   repeat with i = 1 to lastcard
  264.     go to card i of background "work"
  265.     put "Resetting slide " & i & " of " & lastcard & "."
  266.     CleanUp
  267.     lockFields
  268.   end repeat
  269.   put empty into msg
  270.   hide msg
  271.   pop card
  272.   hidetools
  273.   hide menubar
  274.   unlock screen
  275.   set the lockMessages to false
  276. end resetAll
  277.  
  278. on CleanUp
  279.   lock screen
  280.   repeat with i = 1 to the number of card fields
  281.     if "PopUp" is in the short name of card field i
  282.     then hide card field i
  283.   else if the short name of card field i is "TypeWriter"
  284.   then put empty into card field i
  285. else if the style of card field i is "Scrolling"
  286. then set the scroll of card field i to 0
  287. set the cursor to busy
  288. end repeat
  289. repeat with i = 1 to the number of buttons
  290.   put the short name of button i into TheName
  291.   set the cursor to busy
  292.   if TheName is not "Hidden" and "┬á" is not in TheName
  293.   then show button i   --looks for OPTION space in TheName
  294.   if (word 1 of theName is "Shrinker") then send restore to button i
  295.   else if "Step" is in TheName then RestoreStep i
  296.   else if TheName is "Shutter"
  297.   then set the style of button i to opaque
  298. else if TheName is "Hiliter"
  299. then set the hilite of button i to false
  300. else if TheName is "Inverter"
  301. then set the hilite of button i to true
  302. else if TheName is "Checkbox Dingbat"
  303. then set the icon of button i to 10454
  304. else if TheName is "Arrow Dingbat"
  305. then set the icon of button i to 2415
  306. end repeat
  307. if field "LineSpecs" is not empty or field "GraphArea" is not empty
  308. then
  309. set the cursor to busy
  310. choose reg poly tool
  311. set the cursor to busy
  312. domenu "revert"
  313. choose browse tool
  314. set the cursor to busy
  315. end if
  316. unlock screen
  317. set the cursor to browse
  318. end CleanUp
  319.  
  320. on DoFX direction
  321.   if direction is "next" then
  322.     put 1 into FXLine
  323.   else
  324.     put 2 into FXLine
  325.   end if
  326.   if field "FX" is not empty
  327.   then
  328.   set the cursor to busy
  329.   put line FXLine of field "FX" into request
  330.   do "visual effect" && request
  331. end if
  332. do "go " & direction
  333. end DoFX
  334.  
  335. on ChangeAutoReset
  336.   global WorkMenu
  337.   --field ID 306 exists only to use its name as a "durable" global
  338.   --variable, i.e. one which survives exits from HyperCard
  339.   if true is in the name of field id 306 then
  340.     set the name of field id 306 to "AutoReset false"
  341.     CheckMenu WorkMenu,12,False
  342.   else
  343.     set the name of field id 306 to "AutoReset true"
  344.     CheckMenu WorkMenu,12,True
  345.   end if
  346. end ChangeAutoReset
  347.  
  348. on RestoreStep wanted
  349.   put the id of button wanted into wanted
  350.   put 1 into item 1 of line wanted of field "Chains"
  351.   if item 2 of line wanted of field "Chains" is empty then
  352.     set the name of button ID wanted to "Step (1)"
  353.   else
  354.     set the name of button ID wanted to "Step 1"
  355.   end if
  356. end RestoreStep
  357.  
  358. on newLecture
  359.   global Mode
  360.   show msg at 15,280
  361.   put "Creating new SmartSlides stack. Please be patient."
  362.   HideTools
  363.   lock screen
  364.   set the lockMessages to true
  365.   go to card "FX" of this stack
  366.   domenu "Copy card"
  367.   go to card 1 of this stack
  368.   put "Lecture" into Mode
  369.   doMenu "New Stack..."       --produces clean copy of first background
  370.   put empty into Mode
  371.   if the number of cards is 1 then   --didn't abort menu command
  372.     put "Still working. Please be patient."
  373.     domenu "Paste card"         --adds second background
  374.     go previous
  375.     send SetUp to background button id 26    --show tools
  376.     send mouseUp to background button id 117 --create cd btn "Delay"
  377.     send mouseUp to background button id 119 --create cd btn "Beep"
  378.     send mouseUp to background button id 206 --create cd btn "LockScreen"
  379.     send mouseUp to background button id 233 --create cd btn "Opener"
  380.     put 1 into field "CardNumber"
  381.     --set default effects:
  382.     put "scroll left slowly to card" & return & "scroll right slowly to card" into field "FX"
  383.     put (freesize of this stack) into FS
  384.     if FS > 10000
  385.     then
  386.     put "Compacting Stack (" & FS & " free)"
  387.     domenu "Compact Stack"
  388.     put empty into msg
  389.     hide msg
  390.   end if
  391.   ShowCredits
  392. end if
  393. unlock screen
  394. set the lockMessages to false
  395. beep
  396. end newLecture
  397.  
  398. on domenu which
  399.   global Mode
  400.   if the optionKey is up then
  401.     if which is "New Stack..." and Mode is not "Lecture" then newLecture
  402.     else if which is "Back" then type numtochar(126)
  403.     else if which is "Help" then GiveHelp "General Introduction┬á"
  404.     else pass domenu
  405.     --handling "New StackΓǪ" substitutes newLecture for Apple's menu item
  406.     --to prevent making a lecture stack which is only half-formed;
  407.     --handling "Back" avoids accidentally changing cards
  408.     --when you intend to type ~
  409.   else
  410.     put "For help concerning Apple's menus, see Apple's Help Stack."
  411.     help
  412.   end if
  413. end domenu
  414.  
  415. on MakeCard
  416.   global ToolView
  417.   requestPatience
  418.   put empty into ToolView
  419.   doMenu "New Card"
  420.   send SetUp to background button id 26    --show tools
  421.   send mouseUp to background button id 117 --create cd btn "Delay"
  422.   send mouseUp to background button id 119 --create cd btn "Beep"
  423.   send mouseUp to background button id 206 --create cd btn "LockScreen"
  424.   send mouseUp to background button id 233 --create cd btn "Opener"
  425.   put the number of this card into field "CardNumber"
  426.   --set default effects:
  427.   put "scroll left slowly to card" & return & "scroll right slowly to card" into field "FX"
  428.   put (freesize of this stack) into FS
  429.   if FS > 10000
  430.   then
  431.   put "Compacting Stack (" & FS & " free)"
  432.   domenu "Compact Stack"
  433. end if
  434. put empty into msg
  435. hide msg
  436. end MakeCard
  437.  
  438. on MakeAutoscroll
  439.   lock screen
  440.   set cursor to busy
  441.   requestPatience
  442.   set cursor to busy
  443.   createField 135   --AutoScroller 2
  444.   put the number of card fields into newField
  445.   set cursor to busy
  446.   createButton 79                                 --to hide scroll bar
  447.   set cursor to busy
  448.   choose browse tool
  449.   put the number of card buttons into lastButton
  450.   set the name of button lastbutton to "Inert"
  451.   set the script of button lastbutton to empty
  452.   set cursor to busy
  453.   set the rect of button lastButton to 461,50,484,271
  454.   set cursor to busy
  455.   put "Enter scrolltext" & return & "with return after" & return & "each line." into card field newField
  456.   set cursor to hand
  457.   put empty into msg
  458.   hide msg
  459.   unlock screen
  460.   select text of card field newField
  461. end MakeAutoscroll
  462.  
  463. on MakeTypeWriterField
  464.   global ObjectID
  465.   ask "What do you want typed in the field?" with "Enter text to be typed here."
  466.   put "--" & it into TypeText
  467.   createField 237
  468.   put ObjectID into FieldID
  469.   set the script of card field id FieldID to TypeText
  470.   createButton 266
  471.   set the name of button id ObjectID to "CursorCover "& FieldID
  472.   choose browse tool
  473. end MakeTypeWriterField
  474.  
  475. on doTyping here
  476.   if card field id here is empty
  477.   then
  478.   put the script of card field id here into TypeText
  479.   delete char 1 to 2 of TypeText
  480.   set the locktext of card field id here to false
  481.   select text of card field id here
  482.   repeat with i = 1 to the number of chars of typetext
  483.     if char i of typetext is not space then wait 5
  484.     type char i of typetext
  485.   end repeat
  486.   set the lockText of card field id here to true
  487.   select empty
  488. else
  489.   put "--" & (card field id here) into TypeText
  490.   set the script of card field id here to TypeText
  491.   put empty into card field id here
  492.   if the textalign of card field id here is "right"
  493.   then
  494.   put item 2 of the rect of card field id here into Y1
  495.   put item 3 of the rect of card field id here into X2
  496.   put item 4 of the rect of card field id here into Y2
  497.   set the rect of card button ("CursorCover " & here) to (X2-10),(Y1+1),(X2-3),(Y2-3)
  498. else
  499.   set the rect of card button ("CursorCover " & here) to 0,0,0,0
  500. end if
  501. end if
  502. end doTyping
  503.  
  504. on setEffects
  505.   global FX
  506.   push card
  507.   lock screen
  508.   put field "FX" into FX
  509.   go to card "FX"
  510.   repeat with i = 1 to the number of card fields
  511.     hide card field i
  512.   end repeat
  513.   hide button "Go Back"
  514.   hide picture of card "FX"
  515.   unlock screen
  516. end setEffects
  517.  
  518. on HideTools
  519.   global Toolview, WorkMenu
  520.   set the icon of background button id 26 to 28097
  521.   set the icon of background button id 26 to 24272
  522.   if Toolview is "ButtonTools"
  523.   then
  524.   HideButtonTools
  525. end if
  526.  
  527. if ToolView is "DrawTools"
  528. then
  529. HideDrawTools
  530. end if
  531.  
  532. if ToolView is "FieldTools"
  533. then
  534. HideFieldTools
  535. end if
  536.  
  537. hide background button id 22   --choose buttontool
  538. hide background button id 23   --choose fieldtool
  539. hide background button id 68   --set visual effects
  540. hide background button id 94   --button to show drawing tools
  541. hide background button id 92   --button to show button buttons
  542. hide background button id 93   --button to show field buttons
  543. hide background button id 21   --new card
  544. hide background button id 20   --new stack
  545. hide background button id 126  --CleanUp
  546. set the icon of background button id 26 to 0
  547. set the style of background button id 26 to transparent
  548. hide background button id 98   --black backdrop
  549. changeMenu WorkMenu,3,"Show┬áTools┬á"
  550. lockFields
  551. end HideTools
  552.  
  553. on ShowTools
  554.   global WorkMenu, ToolView
  555.   show background button id 98   --black backdrop
  556.   set the style of background button id 26 to rectangle
  557.   set the icon of background button id 26 to 24272
  558.   set the icon of background button id 26 to 28097
  559.   set the icon of background button id 26 to 15566
  560.   changeMenu WorkMenu,3,"Hide Tools┬á"
  561.   show background button id 81   --emergency editing (right margin)
  562.   show background button id 126  --CleanUp
  563.   show background button id 20   --new stack
  564.   show background button id 21   --new card
  565.   show background button id 93   --show field buttons
  566.   show background button id 92   --show button buttons
  567.   show background button id 94   --show drawing tools
  568.   show background button id 68   --set visual effects
  569.   show background button id 23   --choose fieldtool
  570.   show background button id 22   --choose buttontool
  571.   if ToolView is empty then ShowFieldTools
  572.   else if ToolView is "FieldTools" then ShowFieldTools
  573.   else if ToolView is "ButtonTools" then ShowButtonTools
  574.   else if ToolView is "DrawTools" then ShowDrawTools
  575. end ShowTools
  576.  
  577. on ShowFieldTools
  578.   global FieldsLocked, ToolView
  579.   put "FieldTools" into ToolView
  580.   if FieldsLocked
  581.   then
  582.   set the icon of background button id 25 to "LockedFields"
  583. else
  584.   set the icon of background button id 25 to "UnlockedFields"
  585. end if
  586. show background button id 10   --title field
  587. show background button id 14   --body field
  588. show background button id 12   --full card field
  589. show background button id 69   --large font field
  590. show background button id 121  --popup field
  591. show background button id 249  --shimmerfield
  592. show background button id 250  --bulger
  593. show background button id 251  --rectangle field
  594. show background button id 252  --scrolling
  595. show background button id 253  --typewriter field
  596. show background button id 254  --autoscrolling field
  597. show background button id 11   --columns
  598. show background button id 284  --change font
  599. show background button id 285  --change field style
  600. show background button id 134  --toggle textHeight
  601. show background button id 86   --left align text
  602. show background button id 87   --center align text
  603. show background button id 88   --right align text
  604. show background button id 25   --lock/unlock fields
  605. end ShowFieldTools
  606.  
  607. on HideFieldTools
  608.   hide background button id 25
  609.   hide background button id 88
  610.   hide background button id 87
  611.   hide background button id 86
  612.   hide background button id 134  --toggle textHeight
  613.   hide background button id 285  --change style
  614.   hide background button id 284  --change font
  615.   hide background button id 11
  616.   hide background button id 254  --autoscrolling field
  617.   hide background button id 253  --typewriter field
  618.   hide background button id 252  --scrolling
  619.   hide background button id 251  --rectangle field
  620.   hide background button id 250  --bulger
  621.   hide background button id 249  --shimmerfield
  622.   hide background button id 121
  623.   hide background button id 69
  624.   hide background button id 12
  625.   hide background button id 14
  626.   hide background button id 10
  627. end HideFieldTools
  628.  
  629. on ShowButtonTools
  630.   global ToolView
  631.   put "ButtonTools" into ToolView
  632.   show background button id 99   --chain together
  633.   show background button id 16   --hiliter
  634.   show background button id 129  --tile hiliters
  635.   show background button id 70   --flasher
  636.   show background button id 255  --inverter
  637.   show background button id 256  --greyout
  638.   show background button id 72   --shutter
  639.   show background button id 80   --mask
  640.   show background button id 133  --shrinker
  641.   show background button id 297  --vanilla
  642.   show background button id 257  --stepper
  643.   show background button id 103  --checkbox dingbats
  644.   show background button id 108  --arrow dingbats
  645.   show background button id 109  --hand dingbats
  646.   showChainTools
  647. end ShowButtonTools
  648.  
  649. on HideButtonTools
  650.   hideChainTools
  651.   hide background button id 109  --hand dingbats
  652.   hide background button id 108  --arrow dingbats
  653.   hide background button id 103  --checkbox dingbats
  654.   hide background button id 297  --vanilla
  655.   hide background button id 257  --stepper
  656.   hide background button id 133  --shrinker
  657.   hide background button id 80   --mask
  658.   hide background button id 72   --shutter
  659.   hide background button id 256  --greyout
  660.   hide background button id 255  --inverter
  661.   hide background button id 70   --flasher
  662.   hide background button id 129  --tile hiliters
  663.   hide background button id 16   --hiliter
  664.   hide background button id 99   --chain together
  665. end HideButtonTools
  666.  
  667. on showChainTools
  668.   show background button id 117  --Delay
  669.   show background button id 119  --Beep
  670.   show background button id 206  --LockScreen
  671.   show background button id 233  --Opener
  672.   show background button id 271  --Linker
  673.   if field "GraphArea" is not empty
  674.   then show background button id 272  --Graph
  675.   if field "LineSpecs" is not empty
  676.   then show background button id 273  --Draw
  677.   if field "PopUps" is not empty
  678.   then show background button id 270  --PopUp
  679. end showChainTools
  680.  
  681. on HideChainTools
  682.   hide background button id 270  --PopUp
  683.   hide background button id 273  --Draw
  684.   hide background button id 272  --Graph
  685.   hide background button id 271  --Linker
  686.   hide background button id 233  --Opener
  687.   hide background button id 206  --LockScreen
  688.   hide background button id 119  --Beep
  689.   hide background button id 117  --Delay
  690. end HideChainTools
  691.  
  692. on ShowDrawTools
  693.   global ToolView
  694.   put "DrawTools" into ToolView
  695.   show background button id 27   --drawline
  696.   show background button id 258  --drawline wavy
  697.   show background button id 259  --drawline dotted
  698.   show background button id 102  --drawarrow
  699.   show background button id 260  --drawArrow wavy
  700.   show background button id 261  --drawArrow dotted
  701.   show background button id 262  --border field
  702.   show background button id 263  --shadow field
  703.   show background button id 264  --connect fields
  704.   show background button id 265  --make graph
  705.   show background button id 84   --erase recent/all
  706.   show background button id 293  --protect recent
  707. end ShowDrawTools
  708.  
  709. on HideDrawTools
  710.   hide background button id 293  --protect recent
  711.   hide background button id 84   --erase recent/all
  712.   hide background button id 265  --make graph
  713.   hide background button id 264  --connect fields
  714.   hide background button id 263  --shadow field
  715.   hide background button id 262  --border field
  716.   hide background button id 261  --drawArrow dotted
  717.   hide background button id 260  --drawArrow wavy
  718.   hide background button id 102  --drawArrow
  719.   hide background button id 259  --drawline dotted
  720.   hide background button id 258  --drawline wavy
  721.   hide background button id 27   --drawLine
  722. end HideDrawTools
  723.  
  724. on ShowNumber
  725.   global WorkMenu
  726.   show field "CardNumber"
  727.   push card
  728.   lock screen
  729.   set the lockmessages to true
  730.   go to card 1 of background "FX"
  731.   set the visible of field "CardNumber" to true
  732.   pop card
  733.   set the lockmessages to false
  734.   unlock screen
  735.   ChangeMenu WorkMenu,9,"Hide Slide Numbers┬á"
  736. end ShowNumber
  737.  
  738. on HideNumber
  739.   global WorkMenu
  740.   hide field "CardNumber"
  741.   lock screen
  742.   set the lockmessages to true
  743.   push card
  744.   go to first card of background "FX"
  745.   set the visible of field "CardNumber" to false
  746.   pop card
  747.   set the lockmessages to false
  748.   unlock screen
  749.   ChangeMenu WorkMenu,9,"Show Slide Numbers┬á"
  750. end HideNumber
  751.  
  752. on SortAll
  753.   sort numeric by field "CardNumber"
  754.   go first
  755. end SortAll
  756.  
  757. function clickLine
  758. --Improved version of Apple's script.
  759. --Using clickloc is more reliable than using MouseV.
  760. --MouseV may have changed between time mouse was clicked
  761. --and time instruction is executed.
  762.  
  763. if the style of the target is "scrolling" then
  764.   put the scroll of the target into Scroll
  765. else
  766.   put 0 into Scroll
  767. end if
  768. return ((((item 2 of the clickloc)  + Scroll) - (item 2 of the rect of the target + 4)) ┬¼ -- 4 to allow for descenders
  769. div the textheight of the target) + 1
  770. end clickLine
  771.  
  772. on shrink NextObject
  773.   put the rect of button id NextObject into rectWanted
  774.   put word 2 of the short name of button id NextObject into increment
  775.   put the bottom of button id NextObject into thisBottom
  776.   add increment to item 2 of rectwanted
  777.   if thisBottom - (item 2 of rectwanted) < (increment*0.75)
  778.   then
  779.   put thisBottom into item 2 of rectwanted
  780. end if
  781. lock screen
  782. set the rect of button id NextObject to rectWanted
  783. unlock screen
  784. add 1 to item 1 of line NextObject of field "Chains"
  785. end shrink
  786.  
  787. on TabToFirst
  788.   global ThisName, ThisSpot, ThisLine
  789.   put quote & thisName & quote into word 6 of ThisSpot
  790.   put ThisLine + 1 into word 2 of ThisSpot
  791. end TabToFirst
  792.  
  793. on TabToLast
  794.   global ObjectNumber, ThisName, ThisLine, ThisSpot
  795.   put ObjectNumber into LastColumn
  796.   repeat with i = ObjectNumber to the number of card fields
  797.     if thisName is not the short name of card field i
  798.     then exit repeat
  799.   else
  800.     put i into LastColumn
  801.   end if
  802. end repeat
  803. put LastColumn into word 6 of ThisSpot
  804. put max(1,(ThisLine - 1)) into word 2 of ThisSpot
  805. end TabToLast
  806.  
  807. on tabkey
  808.   global TabWidth, ThisSpot, ObjectNumber, ThisName, ThisLine, TabDirection
  809.   if the shiftKey is "down" then put -1 into TabDirection
  810.   else put 1 into TabDirection
  811.   if the selectedchunk is empty
  812.   then                          --put cursor in first card field, if any
  813.   if the number of card fields > 0
  814.   then
  815.   select after text of card field 1
  816. else
  817.   pass TabKey
  818. end if
  819. else
  820.   put the short name of the selectedfield into thisName
  821.   if "Column" is in thisName
  822.   then                      --move to same line of next column, if any
  823.   put the selectedline into ThisSpot
  824.   put word 2 of ThisSpot into ThisLine
  825.   put word 6 of ThisSpot into ObjectNumber
  826.   add tabDirection to word 6 of ThisSpot  --sets normal expectations
  827.   --                                      --but check for exceptions
  828.   if tabDirection is 1
  829.   then
  830.   if the number of card fields <= ObjectNumber    --no next column
  831.   then TabToFirst
  832. else
  833.   --if "Column" is not in the short name --old version
  834.   if thisName is not in the short name of card field (ObjectNumber + 1)
  835.   then
  836.   TabToFirst
  837. end if
  838. end if
  839. else --expecting to move to previous column, but see if one exists
  840.   if ObjectNumber = 1                          --no previous field
  841.   then TabToLast
  842. else                                 --check for previous column
  843.   if thisName <> (the short name of card field (ObjectNumber - 1))
  844.   then                                      --no previous column
  845.   TabToLast
  846. end if
  847. end if
  848. end if            --all necessary adjustments to thisSpot now made
  849. select after ThisSpot
  850. else if ThisName is "XValues" then TabToY    --in background column
  851. else if ThisName is "YValues" then TabToX    --in background column
  852. else if ThisName is "XMax" then select line 1 of field "XInt"
  853. else if ThisName is "XInt" then select line 1 of field "XMin"
  854. else if ThisName is "XMin" then select line 1 of field "YMax"
  855. else if ThisName is "YMax" then select line 1 of field "YInt"
  856. else if ThisName is "YInt" then select line 1 of field "YMin"
  857. else if ThisName is "YMin" then select line 1 of field "XMax"
  858. else                                         --not in column; indent
  859.   put the selectedchunk into here
  860.   put ((word 2 of here) - 1) into word 4 of here
  861.   do "select " & here           --taking care not to delete anything
  862.   repeat with i = 1 to TabWidth
  863.     type " "
  864.   end repeat
  865. end if
  866. end if
  867. end tabkey
  868.  
  869. on TabToX
  870.   global TabDirection
  871.   put word 2 of the selectedline into ThisLine
  872.   if TabDirection is 1 then add 1 to ThisLine
  873.   if ThisLine > 16 then put 1 into ThisLine
  874.   select after line ThisLine of field "XValues"
  875. end TabToX
  876.  
  877. on TabToY
  878.   global TabDirection
  879.   put word 2 of the selectedline into ThisLine
  880.   if TabDirection is -1 then subtract 1 from ThisLine
  881.   if ThisLine < 1 then put 16 into ThisLine
  882.   select after line ThisLine of field "YValues"
  883. end TabToY
  884.  
  885. on returnInField
  886.   if the shiftKey is not "down"
  887.   then pass returnInField
  888. else
  889.   put the selectedline into ThisSpot
  890.   if word 2 of thisSpot is not 1
  891.   then
  892.   subtract 1 from word 2 of ThisSpot
  893.   select after ThisSpot
  894. else
  895.   pass returnInField
  896. end if
  897. end if
  898. end returnInField
  899.  
  900. on CreateField wanted
  901.   global FieldsLocked, ObjectNumber, ObjectID
  902.   lock screen
  903.   show field id wanted
  904.   select field id wanted
  905.   domenu "copy field"
  906.   domenu "paste field"
  907.   hide field id wanted
  908.   put the number of card fields into ObjectNumber
  909.   put the ID of card field ObjectNumber into ObjectID
  910.   if wanted is 237 --typewriter field
  911.   then
  912.   lockFields
  913. else
  914.   put false into FieldsLocked
  915.   set the icon of background button id 25 to "UnlockedFields"
  916.   if wanted is not 137 and wanted is not 122 --not Rectangle or PopUp
  917.   then
  918.   choose browse tool
  919.   unlock screen
  920.   select char 1 to 0 of card field ObjectNumber
  921. else
  922.   unlock screen
  923. end if
  924. end if
  925. end CreateField
  926.  
  927. on CreateButton wanted
  928.   global ObjectNumber, ObjectID
  929.   show background button id wanted
  930.   select background button id wanted
  931.   domenu "copy button"
  932.   domenu "paste button"
  933.   hide background button id wanted
  934.   put the number of buttons into ObjectNumber
  935.   put the ID of button ObjectNumber into ObjectID
  936. end CreateButton
  937.  
  938. on arrowkey which
  939.   if which is "left" or which is "right"
  940.   then
  941.   set the lockmessages to true
  942.   if which is "left" then go previous
  943.   if which is "right" then go next
  944.   set the lockmessages to false
  945. else
  946.   pass arrowkey
  947. end if
  948. end arrowkey
  949.  
  950. on GiveHelp whatever
  951.   put quote & whatever into wanted
  952.   if last char of wanted is "┬á" then delete last char of wanted
  953.   put quote after wanted
  954.   if "Menu" is not in wanted then put " Command" after wanted
  955.   put "Getting Help Concerning: " & wanted
  956.   push card
  957.   lock screen
  958.   set the lockMessages to true
  959.   go to stack "SmartSlides 1.1 Help"
  960.   go to card whatever
  961.   unlock screen
  962.   hide msg
  963.   set the lockmessages to false
  964.   exit to HyperCard
  965. end GiveHelp
  966.  
  967. on PrepForPrinting
  968.   ShowNumber
  969.   put the number of cards of background "work" into lastCard
  970.   repeat with i = 1 to lastCard
  971.     go to card i of background "work"
  972.     put "Preparing card " & i & " of " & lastCard & "."
  973.     repeat with i = 1 to the number of buttons
  974.       if the style of button i is not "transparent"
  975.       then hide button i
  976.     end repeat
  977.   end repeat
  978.   put "Ready for printing."
  979. end PrepForPrinting
  980.  
  981. on ShowCredits
  982.   hide menubar
  983.   send ClearCard to Field "Scripts"
  984.   put empty into field "Credits"
  985.   show field "Credits"
  986.   put "SmartSlides          Philosophy Department" & return into field "Credits"
  987.   put "version 1.1              Syracuse University┬á" & return after field "Credits"
  988.   put "┬⌐ June 5, 1990           Syracuse, NY  13244┬á┬á┬á" & return after field "Credits"
  989.   put "Mark A. Brown               (315) 443-5818┬á┬á┬á┬á┬á" & return & return after field "Credits"
  990.   put "SmartSlides, its name, design and scripts, are all copyrighted." & return & return after field "Credits"
  991.   put "THIS STACK IS SHAREWARE. " & return after field "Credits"
  992.   put "You may freely copy it and give away copies," & return after field "Credits"
  993.   put "as long as you preserve its copyright and shareware notices." & return after field "Credits"
  994.   put "YOU MAY NOT SELL IT." & return after field "Credits"
  995.   put "If you use this to give a lecture or presentation," & return after field "Credits"
  996.   put "or as the base for another stack for similar purposes," & return after field "Credits"
  997.   put "please send $15 to me at the above address" & return after field "Credits"
  998.   put "the first time you use it." & return after field "Credits"
  999.   put "Include your name & address and" & " I'll send you a copy of the manual." & return after field "Credits"
  1000.   put "XCMDs and XFCNs are freeware from Nine To Five Software." & return after field "Credits"
  1001.   put "My thanks to them for making extra menus possible." & return after field "Credits"
  1002.   show background button "Smart Help"
  1003.   show msg at 15,320
  1004.   put "     CLICK IN FIELD TO CONTINUE OR CLICK ON BUTTON FOR HELP"
  1005. end ShowCredits
  1006.  
  1007.